<?php $this -> load -> view('/includes/header.php'); ?>
<div class= 'col-sm-12'>
    <form class='form-horizontal well' id='sngForm'method="post" action ='<?php echo site_url('catalog/saveSong')?>'>
        <legend>
            <?php echo isset($song_id) ? 'Manage Song' : 'New Song'; ?>
        </legend>
        <fieldset>
            <input id = 'song_id' name='song_id' type="hidden" value = '<?php echo isset($song_id) ? $song_id : ''; ?>' />
            <div class ='form-group'>
                <div class='col-sm-12'>
                    <input type="text" placeholder = 'Name' class="form-control" name = 'name'id='name' value = '<?php echo isset($name) ? $name : ''; ?>'/>
                </div>
            </div>
            <div class ='form-group'>
                <div class='col-sm-12'>
                    <input type="text" placeholder = 'Artist' class="form-control" name='artist'id='artist' value = '<?php echo isset($artist) ? $artist : ''; ?>'/>
                </div>
            </div>
            <div class ='form-group'>
                <div class='col-sm-12'>
                    <input type="text" placeholder="Genre" class="form-control" name='genre'id='genre'value = '<?php echo isset($genre) ? $genre : ''; ?>' />
                </div>
            </div>
            <div class ='form-group'>
                <div class='col-sm-12'>
                    <textarea id='lyrics' rows= '30' class='form-control'name ='lyrics' placeholder='Lyrics'><?php echo isset($lyrics) ? $lyrics : ''; ?></textarea>
                </div>
            </div>
            <div class ='form-group'>
                <div class='col-sm-12'>
                    <div class='input-group'>
                        <input type="text" placeholder="External URL" class="form-control" id='external_url' name='external_url'value = '<?php echo isset($external_url) ? $external_url : ''; ?>' />
                        <span class= 'input-group-addon'><a href='#'><i class='glyphicon glyphicon glyphicon-link'></i></a></span>
                    </div>
                </div>
            </div>
            <div class='form-action'>
                <hr>
                <button type='submit' class="btn btn-success">
                    Save
                </button>
                <a class='btn btn-default'>Cancel</a>
            </div>
        </fieldset>
    </form>
</div>
<script>
    $('.glyphicon-link').click(function() {
        window.open($('#external_url').val(), '_blank');
    })
</script>